---
sidebar_label: Anthropic
---

# ChatAnthropic

LangChain supports Anthropic's Claude family of chat models.

You'll first need to install the [`@langchain/anthropic`](https://www.npmjs.com/package/@langchain/anthropic) package:

import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx";

<IntegrationInstallTooltip></IntegrationInstallTooltip>

```bash npm2yarn
npm install @langchain/anthropic
```

You'll also need to sign up and obtain an [Anthropic API key](https://www.anthropic.com/).
Set it as an environment variable named `ANTHROPIC_API_KEY`, or pass it into the constructor as shown below.

## Usage

You can initialize an instance like this:

import CodeBlock from "@theme/CodeBlock";
import Anthropic from "@examples/models/chat/integration_anthropic.ts";

<CodeBlock language="typescript">{Anthropic}</CodeBlock>

## Multimodal inputs

Claude-3 models support image multimodal inputs. The passed input must be a base64 encoded image with the
filetype as a prefix (e.g. `data:image/png;base64,{YOUR_BASE64_ENCODED_DATA}`).
Here's an example:

import AnthropicMultimodal from "@examples/models/chat/integration_anthropic_multimodal.ts";

<CodeBlock language="typescript">{AnthropicMultimodal}</CodeBlock>

See [the official docs](https://docs.anthropic.com/claude/docs/vision#what-image-file-types-does-claude-support)
for a complete list of supported file types.

## Custom headers

You can pass custom headers in your requests like this:

import AnthropicCustomHeaders from "@examples/models/chat/integration_anthropic_custom_headers.ts";

<CodeBlock language="typescript">{AnthropicCustomHeaders}</CodeBlock>
